<?php

class Wmp_Controller_Action extends Zend_Controller_Action
{
	protected $_config;//URGENT : maintenant que j'ai fait ça, je peux faire $this->_config
	//dans les controlleurs... au lieu de Zend_Registry::get('config'); 

    public function init()
    {
        /*$memberSession = new Zend_Session_Namespace('member');
        if($memberSession->member) {
            $this->view->layout()->member = $memberSession->member;
        }
        $this->view->headMeta('my, list, of, cool, keywords, goes, here','keywords');
        $this->view->headTitle(Globals::getConfig()->title);
        
        //TODO:bon Ã  savoir
        $this->view->placeholder('Zend_Layout')->footer = $this->view->partial('footer.phtml',
                                                   null,
                                                   array('copyright'=>"(c) 2008 Cal Evans, All Rights Reserved")) ;
        */
    	$this->_config = Zend_Registry::get('config');    	
        return;
    }    
   
	//URGENT : vérifier dans la dernière version de Zend Framework s'il y en a pas une
	//alternative
    protected function translate($data)
    {
        $translate =  Zend_Registry::get('Zend_Translate');
		return $translate->translate($data);
    }

    protected function generateToken($seed='book')
    {
        $token = md5($seed.mktime());
        $globalSession = new Zend_Session_Namespace('global_data');
        $globalSession->token = $token;
       return $token;
    }
    
    protected function tokenCheck($tokenToCheck='')
    {
        $globalSession = new Zend_Session_Namespace('global_data');
        $returnValue   = (!empty($tokenToCheck) and $tokenToCheck==$globalSession->token);
        return $returnValue;        
    }
    
} // class BaseController extends Zend_Controller_Action
//TODO : adopter ce style de commentaire à la fin des accolades